import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PartnerVO, PartnerForm, PartnerQuery } from '@/api/hrp/partner/types';

/**
 * 查询合作伙伴列表
 * @param query
 * @returns {*}
 */

export const listPartner = (query?: PartnerQuery): AxiosPromise<PartnerVO[]> => {
  return request({
    url: '/hrp/partner/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询合作伙伴详细
 * @param id
 */
export const getPartner = (id: string | number): AxiosPromise<PartnerVO> => {
  return request({
    url: '/hrp/partner/' + id,
    method: 'get'
  });
};

/**
 * 新增合作伙伴
 * @param data
 */
export const addPartner = (data: PartnerForm) => {
  return request({
    url: '/hrp/partner',
    method: 'post',
    data: data
  });
};

/**
 * 修改合作伙伴
 * @param data
 */
export const updatePartner = (data: PartnerForm) => {
  return request({
    url: '/hrp/partner',
    method: 'put',
    data: data
  });
};

/**
 * 删除合作伙伴
 * @param id
 */
export const delPartner = (id: string | number | Array<string | number>) => {
  return request({
    url: '/hrp/partner/' + id,
    method: 'delete'
  });
};
